/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.p10.miage.gestionnote.form;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author gernni
 */
public class AjouterControleActionForm extends org.apache.struts.action.ActionForm {
    
    private int idec; //caché
    private int idp; //caché
    private int idcontrole;
    private String label;
    private float coefficient;
   // private String dispense;
    private int type;
    private int echelle;
    private int sizeListeNote;
    private Map<String,String> HashMap ;

    public int getIdcontrole() {
        return idcontrole;
    }

    public void setIdcontrole(int idcontrole) {
        this.idcontrole = idcontrole;
    }
    
    public int getSizeListeNote() {
        return sizeListeNote;
    }

    public void setSizeListeNote(int sizeListeNote) {
        this.sizeListeNote = sizeListeNote;
    }

    public Map<String, String> getHashMap() {
        return HashMap;
    }

    public void setHashMap(Map<String, String> HashMap) {
        this.HashMap = HashMap;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public float getCoefficient() {
        return coefficient;
    }

    public void setCoefficient(float coefficient) {
        this.coefficient = coefficient;
    }

    public int getIdec() {
        return idec;
    }

    public void setIdec(int idec) {
        this.idec = idec;
    }

//    public String getDispense() {
//        return dispense;
//    }
//
//    public void setDispense(String dispense) {
//        this.dispense = dispense;
//    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getIdp() {
        return idp;
    }

    public void setIdp(int idp) {
        this.idp = idp;
    }

    public int getEchelle() {
        return echelle;
    }

    public void setEchelle(int echelle) {
        this.echelle = echelle;
    }

    /**
     *
     */
    public AjouterControleActionForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        Map<String,String> HashMapTmp = new HashMap<String,String>();
        for(int i=0;i<sizeListeNote;i++)
        {
             HashMapTmp.put(request.getParameter("idEtudiant"+i),request.getParameter("note"+i)+"_"+request.getParameter("dispense"+i));
        }
        setHashMap(HashMapTmp);
        
        return errors;
    }
}
